package com.aiyan.edu.api.media;

import com.aiyan.edu.framework.domain.media.MediaFile;
import com.aiyan.edu.framework.domain.media.request.QueryMediaFileRequest;
import com.aiyan.edu.framework.domain.media.response.CheckChunkResult;
import com.aiyan.edu.framework.model.response.QueryResponseResult;
import com.aiyan.edu.framework.model.response.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author: zqzhou
 * @create: 2019/11/11 21:28
 **/
@Api(value = "媒资文件管理接口", description = "媒资文件管理接口")
public interface MediaFileControllerApi {

    /**
     * 我的媒资文件查询列表
     *
     * @param page
     * @param size
     * @param queryMediaFileRequest
     * @return
     */
    @ApiOperation("我的媒资文件查询列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "页码", required = true, paramType = "path", dataType = "int"),
            @ApiImplicitParam(name = "size", value = "每页数据条数", required = true, paramType = "path", dataType = "int")
    })
    public QueryResponseResult<MediaFile> findList(int page, int size, QueryMediaFileRequest queryMediaFileRequest);


    /**
     * 上传文件前的注册
     *
     * @param fileMd5
     * @param fileName
     * @param fileSize
     * @param mimeType
     * @param fileExt
     * @return
     */
    @ApiOperation("文件上传注册")
    public ResponseResult register(String fileMd5, String fileName, Long fileSize, String mimeType, String fileExt);

    /**
     * 校验分块，是否存在
     *
     * @param fileMd5
     * @param chunk
     * @param chunkSize
     * @return
     */
    @ApiOperation("校验分块是否存在")
    public CheckChunkResult checkchunk(String fileMd5, Integer chunk, Integer chunkSize);

    /**
     * 上传分块文件
     *
     * @param file
     * @param fileMd5
     * @param chunk
     * @return
     */
    @ApiOperation("上传分块文件")
    public ResponseResult uploadchunk(MultipartFile file, String fileMd5, Integer chunk);

    /**
     * 合并分块
     *
     * @param fileMd5
     * @param fileName
     * @param fileSize
     * @param mimeType
     * @param fileExt
     * @return
     */
    @ApiOperation("合并分块")
    public ResponseResult mergechunks(String fileMd5, String fileName, Long fileSize, String mimeType, String fileExt);
}
